// home/scientific/ScientificCategory.js
import api from "../../utils/api.js";
import utils from "../../utils/utils.js";
import network from "../../utils/network.js";
import formatDate from "../../utils/format_date.js";
const app = getApp();


Page({

  /**
   * 页面的初始数据
   */
  data: {
    autoplay: true,
    interval: 5000,
    duration: 300,
    indicatorDots: true,
    circular: true,
    winWidth: 0, // 屏宽
    advBananer: ['http://image.document.guanmai.cn/1550825052828.png',
      'http://image.document.guanmai.cn/1550825052828.png'
    ],
    navigateItem: [{
      'typeName': '农业化工',
      'img': '/images/keyan1.png'
    }, {
      'typeName': '生物医药',
      'img': '/images/keyan2.png'
    }, {
      'typeName': '建筑水利',
      'img': '/images/keyan3.png'
    }, {
      'typeName': '交通运输',
      'img': '/images/keyan4.png'
    }, {
      'typeName': '自然科学',
      'img': '/images/keyan5.png'
    }], // 导航栏


    keyan: null,
    url: app.globalData.url
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    network.postJson(this, api.getKeyan).then(res => {
      this.setData({
        keyan: res.data.data
      })
    })
  },

  onNavigateItemClick: function (e) {
    let name = e.currentTarget.dataset.name;
    wx.navigateTo({
      url: '/home/scientific/ScientificList?name=' + name
    })
  },

  goScientificDetails(e) {
    let id = e.currentTarget.dataset.id;
    let name = e.currentTarget.dataset.name;
    wx.navigateTo({
      url: '/home/scientific/ScientificDetails?id=' + id + '&name=' + name
    })
  },
})